﻿//-----------------------------------------------------------------
// 创建时间:  2008年11月6日
// 创建者  : WuGui.Yang
//-----------------------------------------------------------------
using System; 
using System.Data;
using System.Data.SqlClient;
using System.Runtime.Serialization;
using System.Collections.Generic;

using Ruandao.MiniDac;

namespace Ruandao.Foundation.DataAccess
{
	/// <summary>
	/// Table [Tag] MiniDac Entity Class 
	/// </summary>
	public partial class TagEntity : EntityBase< TagEntity >
	{
        /// <summary>
        /// 如果提供了无效的标签，抛出ArgumentException。
        /// </summary>
        /// <param name="tagGroupId"></param>
        /// <param name="tags"></param>
        /// <returns></returns>
        static public int[] GetTagIds(int tagGroupId, params string[] tags)
        {
            int[] ids = new int[tags.Length];
            for (int i = 0; i < tags.Length; i++ )
            {
                TagEntity entity = TagEntity.FetchByTagNameIndex(tagGroupId, tags[i]);
                if (entity == null)
                    throw new ArgumentException("提供了无效的标签名称。");

                ids[i] = entity.TagId;
            }
            return ids;
        }
	}

}
